﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

namespace SmartSpace.Core
{
    public class DomainContext: IDisposable
    {
        public DbContext DbContext { get; protected set; }

        public DomainContext(DbContext dbContext)
        {
            DbContext = dbContext;
        }

        public DbEntityEntry Entry(object entity)
        {
            return DbContext.Entry(entity);
        }

        public DbSet<TEntity> Set<TEntity>() where TEntity : class
        {
            return DbContext.Set<TEntity>();
        }

        public int SaveChanges()
        {
            return DbContext.SaveChanges();
        }

        public void Dispose()
        {
            DbContext.Dispose();
        }

        public Database Database
        {
            get
            {
                return DbContext.Database;
            }
        }
    }
}
